package java05;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Java0503y {

	public static void main(String[] args) {
		HashMap<String, Integer> word = new HashMap<String, Integer>();

		Scanner in=new Scanner(System.in);
		String str=in.next();
		while(!str.equals("!!!!!"))
		{
			if(word.get(str) == null)
				word.put(str, 1);
			else
			    word.put(str, word.get(str)+ 1);       
			str=in.next();
		}		
		ArrayList<Map.Entry<String, Integer>> arrayList = new ArrayList<Map.Entry<String, Integer>>(word.entrySet());
        
		Collections.sort(arrayList, new Comparator<Map.Entry<String, Integer>>() {

			@Override
			public int compare(java.util.Map.Entry<String, Integer> o1, java.util.Map.Entry<String, Integer> o2) {
				// TODO Auto-generated method stub
				if(o2.getValue() - o1.getValue()!=0)
		            return o2.getValue() - o1.getValue();
		        return o1.getKey().compareTo(o2.getKey());
			}
		    
		});
		int i=0;
		System.out.println(word.size());
		for (Map.Entry<String, Integer> entry :arrayList) 
		{
			if(i==10)
			{
				break;
			}
			System.out.println(entry.getKey()+"="+entry.getValue());
			i++;
		}
	}

}
